<%@ page language="java" import="java.util.*,java.net.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="java.io.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="styles/basic.css" rel="stylesheet" type="text/css" />

<script language='javascript' type='text/javascript'>
	function getimg() 
	//另存为存放在服务器上图片到本地的方法
	{
		document.execCommand("SaveAs");
	    event.returnValue=false;
	    show.window.location.href=imgSrc.src;
	    timer=setInterval(checkload,100);
	}
	
	function checkload()
	{
		 show.document.execCommand('saveAs');
	    if(show.readyState!="complete")
	    {
	        //调用document.execCommand方法，'Saveas'表示打开文件另存为对话框命令
	        show.document.execCommand('saveAs');
	        clearInterval(timer);
	    }
	}  
</script>

<title>download</title>
</head>

	<body>  
		<img id="imgSrc" width="320px" height="200px" src="images/login_03.gif" alt=""/></br>
		<input id="btnSaveAs" type="button" value="另存为上图" onclick="getimg()"/>&nbsp;&nbsp;
		<iframe src="" name="show"  style="width:0;height:0"></iframe>
	</body>
</html>